package lock;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @program: javase
 * @description: 测试是否重入锁
 * @author: lld
 * @create: 2021-04-27 19:37
 **/
public class Reenterant {
    Lock lock=new ReentrantLock();
    public void a(){
        lock.lock();
        b();
        lock.unlock();
    }
    public void b(){
        lock.lock();
        System.out.println("bbb");
        lock.unlock();
    }

    public static void main(String[] args) {
        Reenterant reenterant = new Reenterant();
        reenterant.a();
    }
}
